<div id="view">
	
	<% if flash[:notice] %>
	  <div id="border_top"></div>
    <div id="notice"><h1><%= flash[:notice] %></h1></div>
    <div id="border_bottom"></div>
	<% end %>
	
	<div id="page_right_side">
    <div id="sections">
      <%= render :partial => 'shared/user_menu' %>
	    <%= render :partial => 'shared/admin_menu' %>
	    <%= render :partial => 'shared/pages_menu' %>
	    <%= render :partial => 'shared/sub_pages' %>
      <%= render :partial => 'shared/datasheets' %>
  	  <%= render :partial => 'shared/recent_news' %>
  	  <%= render :partial => 'shared/vail_address' %>
      <%= render :partial => 'shared/vail_contacts' %>
    </div>
  </div>
	
	<div id="page_left_side">
	  
	  <div class="content">

  	  <div id="page_header">

          <!-- 
        	If a user is logged in, they will see a sticky in the upper right corner of a page.
        	The sticky will indicate what state the page is in. 
        	-->
        	<% if logged_in? %>
        		<div id="page_header_right">
        			<div id="sticky">
        				<% if @page.state == "draft" %>
        					<%= image_tag "/images/sticky_draft.png" %>
        				<% elsif @page.state == "pending" %>
        					<%= image_tag "/images/sticky_pending.png" %>
        				<% elsif @page.state == "published" %>
        					<%= image_tag "/images/sticky_published.png" %>
        				<% end %>
        			</div>
        		</div> <!-- END page_header_right -->
        	<% end %>

        	<div id="page_header_left">
        		<div id="mini_page_header">
        			<div id="mini_left">
        				<% unless @page.graphic.nil? %>
        				<%= image_tag @page.graphic.public_filename(:thumb) %>
        				<% end %>
        			</div>
        			<div id="mini_page_right">
        				<h1><%= @page.name %></h1>
        				<h2><%= @page.headline %></h2>					
        			</div>
        		</div>
        	</div> <!-- END page_header_left -->
		
    	</div> <!-- END page_header -->

      <div class="text_area"><%= markdown @page.body %></div>

      <% if logged_in? %>
        <div id="owner_info" class="left">
      	  <ul>
      		  <li>Page owner:&nbsp;&nbsp;<%= @page.owner_full_name %></li>
      		  <li>Last update at:&nbsp;&nbsp;<%= pretty_date(@page.updated_at) %></li>
      	  </ul>
        </div>
  	
    	  <% if current_user.is_admin? || current_user.is_publisher? %>
	    
    		  <% if @page.state == "pending" %>
      	    <div id="reject_approve_buttons" class="right">
      	      <div id="reject">
      	        <% form_for(:page, :url => page_path(@page), :html => { :method => :put }) do |f| %>
        				  <%= f.hidden_field :state, :value => :draft %>
        				  <%= submit_tag  "reject",
        				                  :onclick => "return #{confirm_javascript_function("Are you sure? REJECT?")}",
        				                  :class => "btn", 
                                  :onmouseover => "this.className='btn btnhov'", 
                                  :onmouseout => "this.className='btn'" %>
        			  <% end %>
      			  </div>
  			    
    			    <div id="approve">
      			    <% form_for(:page, :url => page_path(@page), :html => { :method => :put }) do |f| %>
          				<%= f.hidden_field :state, :value => :published %>
          				<%= submit_tag  "approve",
          				                :onclick => "return #{confirm_javascript_function("Are you sure? APPROVE?")}",
          				                :class => "btn", 
                                  :onmouseover => "this.className='btn btnhov'", 
                                  :onmouseout => "this.className='btn'" %>
          			<% end %>
      			  </div>
    			  </div>			
      	  <% end %>
  	  
    	  <% end %>
	
    	  <!-- <div id="clear"></div> -->

    	  <div id="red_line"></div>

    	  <div id="comments">
      		<div id="most_recent_comments">
      			<h2>Most Recent Comments</h2>
      		</div>
      		<% @page.comments.reverse.each do |comment| %>
      			<div class="comment">
      				<div class="header">
      					<div class="name">Commented by <%= comment.name %></div>
      					<div class="posted_on">posted on <%= pretty_date(comment.created_at) %></div>
      				</div>
              <!-- <div id="clear"></div> -->
      				<div class="body"><%= h(comment.body) %></div>
      			</div>
      		<% end %>
      		<div id="form">
      			<% form_for :comment, :url => comments_path do |form| %>
      				<div id="left"><%= form.text_area :body %></div>
      				<%= form.hidden_field :name, :value => current_user.login %>
      				<%= form.hidden_field :page_id, :value => @page.id %>
      				<div id="right">
      					<p>* Leave a comment</p>
      					<%= submit_tag "Comment" %>
      				</div>
      			<% end %>
      		</div>
      	</div>
      <% end %>

      <!-- <div id="clear"></div> -->

      <br/>
      <div id="small_buttons_container", style="width:<%= get_small_buttons_container_width(@section_pages) %>px;">
      	<% @section_pages.each do |section_page| %>
      	  <div class="small_button">
        		<div class="icon">
        			<% unless section_page.graphic.nil? %>
        				<%= link_to image_tag(section_page.graphic.public_filename(:medium)), 
        				            :controller => section_page.section.name, 
        				            :action => :show, 
        				            :id => section_page  %>
        			<% end %>
        		</div>
        		<h2>
        		  <%= link_to section_page.name, 
        		              :controller => section_page.section.name, 
        		              :action => :show, 
        		              :id => section_page %>
        		</h2>
        	</div>
      	<% end %>
      </div>

      <!-- <div id="clear"></div> -->
    
    </div>
  </div> <!-- END page_left_side -->
  
</div> <!-- END view -->